﻿#pragma once


// CHisChromG

class CHisChromG : public CWnd
{
	DECLARE_DYNAMIC(CHisChromG)

public:
	CHisChromG();
	virtual ~CHisChromG();
private:
	CRect	m_rcArea;
	CFont   font;
	long	m_nMaxYA;		//坐标轴的刻度设置
	long	m_nMaxYB;
	long	m_nMinYA;
	long	m_nMinYB;
	long	m_nXScale;

	Chrom_File			curChrom;
	int		m_nCHX;			//组份来自哪一个通道 0--CHA,1--CHB
	int		m_nLineWidth;	//谱图线宽
	CToolTipCtrl m_Tips;
	CString m_strTipsString;

private:
	void	FindMinMax();
	void RelayEvent(UINT message, WPARAM wParam, LPARAM  lParam);
	float	GetPointTime(CPoint pt);
	CString GetTips(CPoint pt);
	

public:
	void	UpdateGraph(Chrom_File curFile,int nCHX);
	void	SetLineWidth(int nWidth);
	//缩放操作
private:
	bool	m_bMouseDown;
	int		m_nZoomMode;			//缩放状态 0--正常，1--缩放，2--拖动
	CPoint		c_ptDown;			// 鼠标按下时点的坐标
	CPoint		c_ptLast;			// 鼠标移动过程中最后一点坐标

	void	DrawDynamicRect(CDC *pDC, CPoint ptBegin, CPoint ptOld, CPoint ptNew);
	void	CaculateZoom(CPoint ptBegin, CPoint ptEnd);
	float	GetPointY(CPoint pt, int nYIndex);

private:
	void	DrawFrame(CRect rt, CDC *pDC);
	void	DrawCurve(CRect rt, CDC *pDC);
	void	Draw(CDC* pDC, CRect rt);

protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnPaint();
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};


